package com.example.scaffolding.ui.main

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel

class PageViewModel : ViewModel() {

    private val _index = MutableLiveData<Int>()
    val title: LiveData<String> = Transformations.map(_index) {
        when (it) {
            1 -> "展示数据表内容"
            2 -> "展示并行图片加载"
            else -> ""
        }
    }

    fun setIndex(index: Int) {
        _index.value = index
    }
}